package com.findMoneyGame.pages.game.controllers {
	import flash.events.Event;
	import flash.events.MouseEvent;

	import com.findMoneyGame.pages.game.GameLevelPage;
	import com.findMoneyGame.pages.game.GameImage;
	import com.findMoneyGame.pages.game.LevelCompleteConfirmDialog;
	import com.findMoneyGame.pages.game.controllers.Controller;
	import com.findMoneyGame.tools.ImageAdjuster;

	public class PassingController extends Controller {
		private function get passButton () { return _gameLevelPage.passButton; }

		public function PassingController (gameLevelPage : GameLevelPage) {
			super(gameLevelPage);
			passButton.price = gameLevel.data.passLevelPrice;
			passButton.addEventListener(MouseEvent.CLICK, passButtonClick);
		}

		private function passButtonClick (e : Event) {
			if (user.moneyCount >= gameLevel.data.passLevelPrice) {
				user.takeMoney(gameLevel.data.passLevelPrice);
				gameLevel.data.reward = 0;
				_gameLevelPage.levelComplete();
			} else {
				_gameLevelPage.dispatchEvent(new Event(GameLevelPage.NEED_MORE_MONEY));
			}
		}
	}
}